<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.util.*,util.*,dal.*,model.*,bll.*"%>
<%
	PurchaseItemModel obj;
	Object temp = request.getAttribute("purchaseItem");
	if (temp != null) {
		try {
			obj = (PurchaseItemModel) temp;
		} catch (Exception ex) {
			obj = new PurchaseItemModel();
		}
	} else {
		obj = new PurchaseItemModel();
	}
	int idPurchase = obj.getIdPurchase();
	
	
// 	PurchaseModel purchase = CacheUtil.getPurchase(idPurchase);
	
	String purchaseName =CacheUtil.getPurchaseName(idPurchase);
	
// 	int idProject=obj.getIdProject();
// 	boolean hasProject=false;
// 	if(idProject!=Integer.MIN_VALUE)
// 		hasProject=true;
		
	
// 	int idTask=obj.getIdTask();
// 	boolean hasTask=false;
// 	if(idTask!=Integer.MIN_VALUE)
// 		hasTask=true;
	
// 	int idQuotation=obj.getIdQuotation();
// 	boolean hasQuotation=false;
// 	if(idQuotation!=Integer.MIN_VALUE)
// 		hasQuotation=true;
	
// 	int idQuotationItem=obj.getIdQuotationItem();
// 	boolean hasQuotationItem=false;
// 	if(idQuotationItem!=Integer.MIN_VALUE)
// 		hasQuotationItem=true;
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Purchase Item Info</title>
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/inputForm.css" />
<link rel="stylesheet" href="css/listForm.css" />
<link rel="stylesheet" href="css/jquery-ui-1.8.14.custom.css" type="text/css" />
<link rel="stylesheet" href="css/hyjack.css" type="text/css" />
<link rel="stylesheet" href="css/datepicker.css" type="text/css" />
<link rel="stylesheet" href="css/themes/ui-lightness/jquery.ui.all.css" />
<link rel="stylesheet" href="css/jquery-ui-timepicker.css" type="text/css" />
<link rel="stylesheet" href="css/jquery-datepicker.css" />
<link rel="stylesheet" href="css/jquery-dialog.css" />

<script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.select.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.core.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.timepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.js"></script>
<script language="javascript" type="text/javascript" src="js/ajaxQuickInsert.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.numeric.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.tools.min.js"></script>
<script language="javascript" type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>


<script language="javascript" type="text/javascript">
$(document).ready(pageLoaded);

function pageLoaded()
{ 
 	turnOnNumbericInput();
	initTooltip();
	
}


	
</script>
</head>
<body>
	<div class="divContainer">
		<%@ include file="menu.jsp"%>
				<form id="inputForm" action=""  >
					<table class="tblInput">
						<tr>
							<td colspan="7"><b>Purchase:<%=purchaseName%></b></td>
						</tr>
						<tr>
							<td class="inputHeader">PURCHASE ITEM INFO</td>
						</tr>
						<tr>
					<td style="padding-left: 200px; padding-right: 200px;">
						<table cellspacing="0px">
						<tr class="trField">
							<td class="tdFieldName">Id</td>
							<td class="tdFieldInput">
								<input class="inputInt readonly" type="text" id="id" name="id" readonly="readonly" value="<%=obj.getId()%>" title="Id of this purchase Item." />
								
							</td>
							<td class="tdErrMsg"></td>
							
							<td rowspan="9"></td>
							
							<td class="tdFieldName">Quantity</td>
							<td class="tdFieldInput">
								<input class="inputNumeric" type="text" id="quantity" name="quantity" readonly="readonly" value="<%=obj.getQuantityToString() %>" title="Quantity of the purchaseItem." maxlength="20" />
							</td>
							<td class="tdErrMsg">
								
							</td>
							
							
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Product</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Product of this purchase item." type="text" value="<%=CacheUtil.getChecklistItemName(obj.getIdTask()) %>"  maxlength="255" />
							</td>
							<td class="tdErrMsg">
							</td>	
							
							<td class="tdFieldName">Discount</td>
							<td class="tdFieldInput">
								<input class="inputNumeric" type="text" id="discount" name="discount" readonly="readonly" value="<%=obj.getDiscountToString() %>" title="Purchase Item discount." maxlength="20" />
							</td>
							<td class="tdErrMsg">
							</td>
							
							
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Service</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Service of this purchase item." type="text" value="<%=CacheUtil.getServiceName(obj.getIdService()) %>"  maxlength="255" />
							</td>
							<td class="tdErrMsg">
							</td>	
							
							<td class="tdFieldName">Additional Cost</td>
							<td class="tdFieldInput">
								<input class="inputNumeric" type="text" id="additional_cost" name="additional_cost" readonly="readonly" value="<%=obj.getAdditionalCostToString() %>" title="Additional cost of the purchaseItem." maxlength="20" />
							</td>
							<td class="tdErrMsg">
							</td>
							
													
														
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Requester</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Requester of this purchase item." type="text" value="<%=CacheUtil.getEmployeeName(obj.getRequester()) %>"  maxlength="255" />
							</td>
							<td class="tdErrMsg">
							</td>
							
							<td class="tdFieldName">Plan Delivery Time</td>
							<td class="tdFieldInput"><input type="text" maxlength="19" class="inputDateTime"  id="plan_delivery_time_date" name="plan_delivery_time_date" readonly="readonly" value="<%=StringUtil.toVisualDateTimeString(obj.getPlanDeliveryTime())%>" title="Plan delivery time." /> 
							</td>
							<td class="tdErrMsg">
								
							</td>
														
							
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Description</td>
							<td class="tdFieldInput">
								<textarea id="description" name="description" rows="5" class="inputTextarea" readonly="readonly" title="Description for the purchase item."><%=obj.getDescriptionToString()%></textarea>
							</td>
							<td class="tdErrMsg">
							</td>
							
							<td class="tdFieldName">Real Delivery Time</td>
							<td class="tdFieldInput"><input type="text" maxlength="19" class="inputDateTime" id="real_delivery_time_date" name="real_delivery_time_date" readonly="readonly" value="<%=StringUtil.toVisualDateTimeString(obj.getRealDeliveryTime())%>" title="Real delivery time." /> 
							</td>
							<td class="tdErrMsg">
								
							</td>
							
							
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Remark</td>
							<td class="tdFieldInput">
								<textarea id="remark" name="remark" rows="5" class="inputTextarea" readonly="readonly" title="remark of the purchaseItem."><%=obj.getRemarkToString()%></textarea>
							</td>
							<td class="tdErrMsg">
							</td>
							
							<td class="tdFieldName">Project</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Project of this purchase item." type="text" value="<%=CacheUtil.getProjectName(obj.getIdProject()) %>"  maxlength="255" />							
							</td>
							<td class="tdErrMsg">
							</td>	
							
														
						</tr>
						<tr>
							<td class="tdFieldName">Status</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Status of this purchase item." type="text" value="<%=StringUtil.getPurchaseItemStatus(obj.getStatus())%>"  maxlength="255" />
							</td>
							<td class="tdErrMsg"></td>
							
							<td class="tdFieldName">Task</td>
							<td class="tdFieldInput">
								
								<input class="inputText" readonly="readonly" title="Task of this purchase item." type="text" value="<%=CacheUtil.getChecklistItemName(obj.getIdTask()) %>"  maxlength="255" />
							</td>
							<td class="tdErrMsg">
							</td>	
							
							
						</tr>
						<tr>
							<td class="tdFieldName">Unit</td>
							<td class="tdFieldInput">
								<input class="inputText" readonly="readonly" title="Unit of this purchase item." type="text" value="<%=CacheUtil.getUnitName(obj.getIdUnit()) %>"  maxlength="255" />
							</td>
							<td class="tdErrMsg">
							</td>	
							
							<td class="tdFieldName">Quotation</td>
							<td class="tdFieldInput">
							
								<input class="inputText" readonly="readonly" title="Quotation of this purchase item." type="text" value="<%=CacheUtil.getQuotationName(obj.getIdQuotation()) %>"  maxlength="255" />
							
							</td>
							<td class="tdErrMsg">
							</td>	
							
						</tr>
						<tr>
							<td class="tdFieldName">Item Price</td>
							<td class="tdFieldInput">
								<input class="inputNumeric" type="text" id="item_price" name="item_price" readonly="readonly" value="<%=obj.getItemPriceToString() %>" title="Item price of the purchaseItem." maxlength="20"  />
							</td>
							<td class="tdErrMsg">
								
							</td>
							
							<td class="tdFieldName">Quotation Item</td>
							<td class="tdFieldInput">
						
								<input class="inputText" readonly="readonly" title="Quotation item of this purchase item." type="text" value="<%=CacheUtil.getQuotationItemName(obj.getIdQuotationItem()) %>"  maxlength="255" />
						
							</td>
							<td class="tdErrMsg">
							</td>	
							
						</tr>
						
						
					</table>
				</td>
			</tr>
		</table>
	</form>
	<%
	
		String urlPurchaseItemList = "purchaseItemList.jsp?embedded=true&idPurchase=" + obj.getIdPurchase();
	%>
		<jsp:include page='<%=urlPurchaseItemList%>'></jsp:include>
	</div>
</body>
</html>